package com.valuablecode.test;

import java.text.*;

import org.hamcrest.*;

public class TimeSpecificationMatcher extends TypeSafeMatcher<TimeSpecification> {

    private final TimeSpecification value;

    public TimeSpecificationMatcher(TimeSpecification value) {
        this.value = value;
    }

    protected boolean matchesSafely(TimeSpecification item) {
        return (value.getHours() == item.getHours()) && 
            (value.getMinutes() == item.getMinutes()) && 
            (value.getSeconds() == item.getSeconds());
    }

    public void describeTo(Description description) {
        description.appendValue(MessageFormat.format("a TimeSpecification for {0}", value));
    }
    
    @Factory
    public static TimeSpecificationMatcher aTimeSpecificationFor(int hours, int minutes, int seconds) {
        return new TimeSpecificationMatcher(new TimeSpecification(hours, minutes, seconds));
    }

}
